package com.lee.boot.head.first.demo.service.impl;

import com.lee.boot.head.first.demo.annotation.MessageLogAnnotation;
import com.lee.boot.head.first.demo.service.AopTestService;

import org.springframework.stereotype.Service;

/**
 * @author: Lee
 * @Date: 2018/10/19 10:44
 * @Description:
 */
@Service
public class AopTestServiceImpl implements AopTestService {

    @Override
    @MessageLogAnnotation(name = "do something")
    public void doSomeThing(String a, String b, String c, String e) throws Exception {
        System.out.println(a + b + c + e);
        String bb = "李衡大好人";
        bb = conver(bb);
        System.out.println(bb);
        if (a != null) {
            throw new Exception("asdsa");
        }
    }


    /**
     * 翻转字符串
     *
     * @param str
     * @return
     */
    public static String conver(String str) {
        char[] chars = str.toCharArray();
        char temp = ' ';
        int endOptional = chars.length / 2;
        for (int i = 0; i < endOptional; i++) {
            temp = chars[i];
            chars[i] = chars[chars.length - 1 - i];
            chars[chars.length - 1 - i] = temp;
        }
        return String.valueOf(chars);
    }
}
